/**
* @Author: qinhaoda
* @Description:
* @File: event
* @Version: 1.0.0
* @Date: 2022/12/30 14:35
 */
package timer

import (
	"fmt"
	"github.com/didi/nightingale/src/modules/agent/ecache"
	"math/rand"
	"time"
)

func UploadEvent() {
	uploadEvent()
	interval := time.Duration(10) * time.Second
	for {
		uploadEvent()
		rand.Seed(time.Now().UnixNano())
		d := rand.Intn(2)
		randTime := time.Duration(d) * time.Second
		time.Sleep(interval + randTime)
	}
}

func uploadEvent() {
	fmt.Printf("文件变化事件的长度 %v\n", ecache.EventCache.Len())
}
